package com.hluobo.library.action;

import javax.annotation.Resource;

import com.hluobo.library.service.UserService;
import com.opensymphony.xwork2.ActionSupport;

//@Component("login")
//@Scope("prototype")
public class LoginAction extends ActionSupport {

	private static final long serialVersionUID = 3904263635005810276L;

	private UserService us;

	private String username;
	private String password;

	@Override
	public String execute() throws Exception {
		if (us.login(username, password) != null){
			//System.out.println(username+":"+password);
			return SUCCESS;
		}
		else
			return "fail";
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public UserService getUs() {
		return us;
	}

	@Resource(name="userService")
	public void setUs(UserService us) {
		this.us = us;
	}

}
